package com.xiaohu.myspace.utils;

import org.hibernate.SessionFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class DBUtils {
   public static synchronized SessionFactory getSessionFactoryFromSpring(){
	   ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");  
	   SessionFactory sessionFactory = (SessionFactory) ctx.getBean("sessionFactory");  
	   System.out.println("sessionFactory="+sessionFactory);
	   return sessionFactory;
   }
}
